/*
 * @lc app=leetcode.cn id=1154 lang=javascript
 *
 * [1154] 一年中的第几天
 */

// @lc code=start
/**
 * @param {string} date
 * @return {number}
 */
var dayOfYear = function(date) {
    let [y,m,d]=date.split("-")
    const computed_two=function(y){
        y=Number(y)
        return (y%4==0&&y%100!=0)||y%100==0&&y%400==0?29:28
    }
    let day=[31,computed_two(y),31,30,31,30,31,31,30,31,30,31]
    d=Number(d)
    for(let i=0;i<m-1;i++){
        d+=day[i]
    }
    return d
};
// @lc code=end

